<?php require "./Application/Home/View/Index/header.php";?>
	<script>
		$('.nav li:nth-child(3) button').addClass('nav_button');
	</script>
	
	<div id="liuyan">

		
		<div style="width: 1000%;margin: 0 auto;max-width: 920px;">
			<!-- <form  action="/Home/Index/addly.html" method="post"> -->
				<h3 style="color: yellow;">发表新留言</h3>
			    <textarea name="note" id="lytxt" style="width: 100%;background: #eee;border:1px solid #666;margin: 10px 0px;height:7rem;color: #000;font-size: 2rem;resize:none;"></textarea>  
			    <div>
			    	<div class="btn btn-danger " id="sendButton" style="color:#000;font-size: 2rem;float: right;padding: 0px 20px;margin-bottom: 20px;color:#fff">发表</div>
					<div style="clear:both;"></div>	
			    </div>
				
			<!-- </form> -->
			<ul>
				<?php 
				$sum = 0;
				foreach ($data as $key => $value) {
					$sum++;
					echo "<li><div>".$sum."</div>".$value['note']."<span class='pull-right'>".$value['create_time']."</span></li>";

				} ?>
				
			</ul>
		</div>
	</div>

	<style>
		#liuyan li{
			position: relative;
			background:#fff;
			width: 100%;
			color: #000;
			text-align: left;
			padding:0px 70px; 
			line-height: 3rem;
			border:1px solid #ccc;
			word-wrap:break-word;

		}
		#liuyan li div{
			position: absolute;
			left: 30px;
		}
	</style>
	<script>
		function ly(){
			console.log();

		}
		$("#sendButton").click(function () {
			if($('#lytxt').val() == '' || $('#lytxt').val() == null){
				return false;
			}
			console.log($('#lytxt').val());
	        // var index = layer.load(1, {shade: 0.6});
	        var params = {'note':$('#lytxt').val()};
	        var url = '/Home/Index/addly';
	        params.ip = returnCitySN['cip'];
	        // returnCitySN['cip'] + returnCitySN['cname']
	        console.log(params.ip);
	        $.ajax({
	            type: "POST",
	            url: url,
	            dataType: 'json',
	            data: params,
	            success: function (data) {
	                console.log(data.success);
	                if(data.success){
	                	history.go(0);
	                }else{
	                	alert('留言失败！');
	                }
	                // layer.close(index);
	                // layer.msg(data.message);
	                // if (data.status == 0) {
	                //     layer.msg(data.message);
	                //     parent.window.location.reload();
	                //     parent.layer.close(parentIndex);
	                // } else {
	                //     layer.msg(data.message);
	                //     return false;
	                // }
	            }
	        });
	        
	    });
	</script>
	<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<?php require "./Application/Home/View/Index/footer.php";?>